package com.tanhua.admin.task;

import com.tanhua.admin.service.AnalysisService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class AnalysisTask {

    @Autowired
    private AnalysisService analysisService;

    @Scheduled(cron = "0/30 * * * * ?")
    //@Scheduled(cron = "0 0/10 * * * ?")
    public void analysis(){
        log.info("后台数据统计任务开始执行.....");
        //调用service的方法完成统计
        analysisService.analysis();
        log.info("后台数据统计完成!!!");
    }
}

